package com.bgs.controller;


import com.alibaba.fastjson.JSON;
import com.bgs.common.R;
import com.bgs.pojo.CustomerAddr;
import com.bgs.service.CustomerAddrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * <p>
 * 地址表 前端控制器
 * </p>
 *
 * @author Asia
 * @since 2021-09-14
 */
@RestController
@RequestMapping("/bgs/customer-addr")
public class CustomerAddrController {
    @Autowired
    private CustomerAddrService customerAddrService;

    /**
     * 当前用户添加新地址
     * @param map
     * @return
     */
    @PostMapping("/TowAddAddress")
    public R TowAddAddress(@RequestBody Map map){
        return customerAddrService.TowAddAddress(map);
    }

    @PostMapping("/TowUpdateAddress")
    public R TowUpdateAddress(@RequestBody Map map){
        return customerAddrService.TowUpdateAddress(map);
    }

    /**
     * 根据当前用户id查看用户地址
     * @return
     */
    @GetMapping("/TowListAdd")
    public R TowListAdd(Integer beforeUserId){
        return customerAddrService.TowListAdd(beforeUserId);
    }
}

